<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:67:"/www/wwwroot/xunda-college/application/atxunda/view/user/index.html";i:1705284335;s:69:"/www/wwwroot/xunda-college/application/atxunda/view/index/header.html";i:1700617178;}*/ ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>后台管理系统</title>
<link rel="stylesheet" href="__PUBLIC__css/pintuer.css?v=1.0">
<link rel="stylesheet" href="__PUBLIC__admin/admin.css">
<link rel="stylesheet" href="__PUBLIC__layui/css/layui.css">
<script src="__PUBLIC__js/jquery.js"></script>
<script src="__PUBLIC__js/pintuer.js"></script>
<script src="__PUBLIC__js/cookie.js"></script>
<script src="__PUBLIC__layui/layui.js"></script>
</head>
<style type="text/css">
	.refresh{width: 20px;height: 20px;float: right;margin:10px 20px;display: block;}
</style>
</head>
<?php if(request()->controller() != 'Index'): ?><img src="__PUBLIC__images/refresh.png" class="refresh" title="刷新"><?php endif; ?>
<script type="text/javascript">
	$('.refresh').click(function(){layer.msg('刷新中……');window.location.reload();})
</script>
<script type="text/javascript">
	function openwinx(url,name,w,h) {
		if(!w) w=screen.width-4;
		if(!h) h=screen.height-95;
		window.open(url,name,"width=" + w + ",height=" + h + ",toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no");
	}
</script>
<style type="text/css">
	.inputs{display: inline-block;border: solid 1px #ddd;border-radius: 4px;margin: 0 2px;width: 58px;height: 36px;}
</style>
<body>
	<div class="panel admin-panel">
		<form method="post" action="<?php echo url('document'); ?>" id="listform">
			<div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">
					<li><a href="javascript:void(0)" class="button border-main" onclick="documents()" > 导出表格</a></li>
					<li>
						<select name="action" class="input" style="width:150px; line-height:17px;" onchange="changesearch()">
							<option value="">请选择注册方式</option>
							<option value="1"  <?php if($param['action'] == 1): ?> selected <?php endif; ?>>PC端</option>
							<option value="2"  <?php if($param['action'] == 2): ?> selected <?php endif; ?>>手机端</option>
							<option value="3"  <?php if($param['action'] == 3): ?> selected <?php endif; ?>>小程序端</option>
						</select>
					</li>
					<li>
						<input type="search" placeholder="手机号/邮箱" name="phone" value="<?php echo $param['phone']; ?>" class="input"  style="width:250px; line-height:17px;display:inline-block;"/>
					</li>
					<a href="javascript:void(0)" class="button border-main" onclick="changesearch()">搜索用户</a>
					<a href="?order=record" class="button">观看时长排序</a>
				</ul>
			</div>
			<table class="table table-hover text-center">
				<tr>
					<th>序号</th>
					<th>昵称</th>
					<th>手机号</th>
					<th>会员身份</th>
					<th>有效期</th>
					<th>观看时长</th>
					<th>注册时间</th>
					<th>注册来源</th>
					<th>备注</th>
					<?php if($admin['role_id'] == 1): ?><th>操作</th><?php endif; ?>
				</tr>
				<?php foreach($user_data as $k=>$v): ?>
				<tr>
					<td><input type="checkbox" name="user_id[]" value="<?php echo $v['know_user_id']; ?>" /><?php echo $k+1; ?></td>
					<td><?php echo $v['know_nickname']; ?></td>
					<td><?php echo !empty($v['know_phone'])?$v['know_phone']: $v['know_email']; ?></td>
					<td><?php echo returnUserDispose($v['know_user_id']); ?></td>
					<td><?php echo returnUserExpireDispose($v['know_user_id']); ?></td>
					<td><?php echo Sec2Time($v['records']); ?></td>
					<td><?php echo $v['register_time']; ?></td>
					<td><?php if($v['action'] == 0): ?>PC<?php elseif($v['action'] == 1): ?>手机<?php else: ?>小程序<?php endif; ?></td>
					<td  align="left" style="cursor:pointer;"><span class='remark' data-id=<?php echo $v['know_user_id']; ?>><?php if($v['know_remark']): ?><?php echo $v['know_remark']; else: ?><font color="#ddd">点击修改</font><?php endif; ?></span></td>
					<?php if($admin_id == 1): ?>
					<td>
						<div class="button-group">
							<a class="button border-main" href="<?php echo url('nav_price',['id' => $v['know_user_id'],'page'=>$page,'phone'=>$param['phone'],'start_time'=>$param['start_time'],'end_time'=>$param['end_time']]); ?>"><span class="icon-edit"></span>设置用户身份</a>
							<a class="button border-main" href="<?php echo url('detail',['id' => $v['know_user_id']]); ?>">查看详情</a>
							<a class="button border-main" href="/progress.html?userid=<?php echo $v['know_user_id']; ?>&preview=true" target="_blank">学习进度</a>
							<a class="button border-red" href="<?php echo url('locking',['id' => $v['know_user_id'],'page'=>$page,'phone'=>$param['phone'],'start_time'=>$param['start_time'],'end_time'=>$param['end_time']]); ?>"  onclick="if(confirm('确定操作?')==false)return false;"><span class="icon-trash-o"></span> <?php if($v['locking'] == 1): ?>去锁定（休学）<?php else: ?>去解锁（停止休学）<?php endif; ?></a>
						</div>
				</td>
					<?php endif; ?>
				</tr>
				<?php endforeach; ?>
				<tr>
					<td colspan="10" align="left"><input type="checkbox" id="checkall"/>
					全选 </td>
				</tr>
				<tr><td colspan="10"><?php echo $user_data->render(); ?><input type="number" name="page" class="inputs input_page" placeholder="页码"><input type="button" value="跳转" class="inputs input_button"></td></tr>
			</table>
		</form>
	</div>
</body></html>
<script>
	//搜索
	function documents(){  
		$("#listform").submit();
	}
	function changesearch(){
		$("#listform").attr('action','/atxunda/user/index');    //通过jquery为action属性赋值
		$("#listform").submit();   //提交ID为myform的表单
	}
	//全选
	$("#checkall").click(function(){ 
		$("input[name='user_id[]']").each(function(){
			if (this.checked) {
				this.checked = false;
			}
			else {
				this.checked = true;
			}
		});
	});
	$('.input_button').click(function(){
		var page = $('.input_page').val();
		if(!page){
			layer.msg('请输入页码',function(){})
		}else{
			window.location.href='/atxunda/user/index?page='+page;
		}
	});
	$(document).on('click','.remark',function(){
		var content = $(this).text();
		if(content == '点击修改') content = '';
		$(this).parent().html('<textarea placeholder="备注" name="remark" value="'+content+'" class="input fo" style="width:200px;height:50px" data-id="'+$(this).data('id')+'">'+content+'</textarea>');
	});
	$(document).on('blur','.fo',function(){
		var _ts = $(this);
		$.ajax({
			data:{id:_ts.data('id'),remarks:_ts.val()},
			url:"/atxunda/user/changeremark",
			type:'post',
			success:function(obj){
				var content = _ts.val();
				if (content == '' ) content = '<font color="#ddd">点击修改</font>';
				_ts.parent().html('<span class="remark" data-id="'+_ts.data('id')+'">'+content+'</span>');
			}
		})
	});
</script>